package luo.utils;

import org.mindrot.jbcrypt.BCrypt;

/**
 * @Description:
 * @Author:let_free
 * @Date:2024/10/3/13:10
 **/
public class PasswordUtil {
    // 生成哈希密码
    public static String hashPassword(String plainPassword) {
        return BCrypt.hashpw(plainPassword, BCrypt.gensalt());
    }

    // 验证密码
    public static boolean verifyPassword(String plainPassword, String hashedPassword) {
        return BCrypt.checkpw(plainPassword, hashedPassword);
    }
}
